package com.design.mode.abstractfactory;

import com.design.mode.factory.Circle;
import com.design.mode.factory.Rectangle;
import com.design.mode.factory.Shape;
import com.design.mode.factory.Square;

/**
 * @Date 2023/3/29 11:32:41
 * @Author luopeng
 */
public class ShapeFactory extends AbstractFactory {

    @Override
    public Shape getShape(String shapeType) {
        if (Circle.class.getSimpleName().equalsIgnoreCase(shapeType)) {
            return new Circle();
        } else if (Rectangle.class.getSimpleName().equalsIgnoreCase(shapeType)) {
            return new Rectangle();
        } else if (Square.class.getSimpleName().equalsIgnoreCase(shapeType)) {
            return new Square();
        }
        throw new IllegalArgumentException("The factory don't have the shapeType of " + shapeType);
    }

    @Override
    Color getColor(String color) {
        return null;
    }
}
